const webpack = require("webpack");
const { NODE_ENV } = process.env;

module.exports = (config) => {
  config.when(NODE_ENV === "development", (config) => {
    // 不监听node_modules模块下文件的改动
    config.watchOptions({ ignored: /node_modules/ });
  });
  config.when(NODE_ENV === "production", (config) => {
    // igNore
    config
      .plugin("ignore")
      .use(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/));
  });
};
